#-*- coding:utf-8 -*-
#实现修改文件内容


#获取文件内容

newdata=""
with  open("./readwrite.txt","r")  as f:

#修改内容
  for i in  f:
    if "ok" in i:
      i = i.replace("ok", "omok");
  
    newdata += i

with  open("./readwrite.txt","w")  as f:
  f.write(newdata)


print(newdata);
#fileuse.writelines(newdata); 

#fileuse.close()
#涉及到问题 ，把一个列表写入文件
#直接替换列表中的内容即可，不用分别替换


